import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    //   token: window.localStorage.getItem('token') ,
    adminMenus: []
  },
  mutations: {
    initAdminMenu(state, menus) {
      state.adminMenus = menus
    },

    //   login (state, data) {
    //     state.token = data
    //     window.localStorage.setItem('token', data)
    //   },
    logout(state) {
      // 注意不能用 null 清除，否则将无法判断 user 里具体的内容
      state.token = ''
      window.localStorage.removeItem('token')
      state.adminMenus = []
    }
  },
  actions: {}
})
